import React from 'react';
import { Modal, Form, Input, DatePicker } from 'antd';
const { RangePicker } = DatePicker;

interface AddModelProps {
  visible: boolean;
  onCancel: () => void;
}

const AddModel: React.FC<AddModelProps> = (props) => {
  const { visible, onCancel } = props;
  const [form] = Form.useForm();

  const onFinish = (values:any) => {
    console.log(values);
  };

  return (
    <Modal
      title="创建临时权限"
      visible={visible}
      onCancel={() => {
        onCancel();
      }}
    >
      <Form form={form} name="control-hooks" onFinish={onFinish}>
        <Form.Item name="name" label="名称：" rules={[{ required: true }]}>
          <Input />
        </Form.Item>
        <Form.Item name="time" label="有效期：" rules={[{ required: true }]}>
          <RangePicker />
        </Form.Item>
      </Form>
    </Modal>
  );
};

export default AddModel;
